Harnessing the power of AI: Advanced deep learning models optimization for accurate SARS-CoV-2 forecasting

The pandemic has significantly affected many countries including the USA, UK, Asia, the Middle East and Africa region, and many other countries. Similarly, it has substantially affected Malaysia, making it crucial to develop efficient and precise forecasting tools for guiding public health policies and approaches. Our study is based on advanced deep-learning models to predict the SARS-CoV-2 cases. We evaluate the performance of Long Short-Term Memory (LSTM), Bi-directional LSTM, Convolutional Neural Networks (CNN), CNN-LSTM, Multilayer Perceptron, Gated Recurrent Unit (GRU), and Recurrent Neural Networks (RNN). We trained these models and assessed them using a detailed dataset of confirmed cases, demographic data, and pertinent socio-economic factors. Our research aims to determine the most reliable and accurate model for forecasting SARS-CoV-2 cases in the region. We were able to test and optimize deep learning models to predict cases, with each model displaying diverse levels of accuracy and precision. A comprehensive evaluation of the models’ performance discloses the most appropriate architecture for Malaysia’s specific situation. This study supports ongoing efforts to combat the pandemic by offering valuable insights into the application of sophisticated deep-learning models for precise and timely SARS-CoV-2 case predictions. The findings hold considerable implications for public health decision-making, empowering authorities to create targeted and data-driven interventions to limit the virus’s spread and minimize its effects on Malaysia’s population.


Introduction
Malaysia has encountered significant obstacles in containing the virus's proliferation and addressing its repercussions. Precise forecasting of the pandemic's dynamics is essential for effective decision-making and resource distribution by healthcare institutions, governments, and policymakers. Recently, deep learning models have shown exceptional performance in tackling various challenges in healthcare, image processing, text recognition, and natural language processing. These models have been successfully employed for numerous SARS--CoV-2 predicting tasks, making their use for predicting the pandemic's development in Malaysia particularly relevant. In Malaysia's context, multiple studies have used deep learning models for predicting the pandemic's progression, but a few have used deep learning and optimization together in a single paper. The current paper has extended the deep learning models up to six models with an extended comparison of optimized and non-optimized algorithms. Further, most of the researchers have used only one to three models only. For instance, [1] utilized a multi-input multi-output CNN model to forecast SARS-COV-2 cases in several countries, including Malaysia. Their findings suggested that the CNN model effectively identified local patterns in the data and produced accurate forecasts. Likewise, other research such as [2] explored the use of LSTM and Bi-LSTM models for SARS-COV-2 forecasting in the region, showcasing their capacity to grasp complex temporal dependencies in the data and deliver dependable predictions. [3] used a hybrid deep learning model, SSA, and ConvLSTm network for predicting the wind speed. [4] used advanced comparative prediction models based on random forest, LSTM, and MLP that had high prediction accuracy for commodity prices using text mining methods. The deep learning models discussed in this review encompass Long Short-Term Memory (LSTM), Short-Term Memory (LSTM), Bidirectional LSTM (Bi-LSTM), Convolutional Neural Networks (CNN), CNN-LSTM, Gated Recurrent Unit (GRU), Recurrent Neural Network (RNN), and Multi-Layer Perceptron's (MLP). These models have been used in various research projects to forecast SARS-COV-2 cases, fatalities, and recoveries, as well as to predict the effects of distinct government interventions and public health measures [5,6].

SARS-COV-2 pandemic in Malaysia
Following the initial reported case in January 2020, Malaysia has enforced rigorous measures to manage the virus's dissemination. The nation's response has developed over time, adjusting to the pandemic's shifting landscape. Key aspects of Malaysia's response include lockdowns, travel restrictions, mass vaccination drives, healthcare infrastructure enhancement, and testing and tracing capabilities.

Model selection and evaluation
Choosing suitable models and evaluation methods for SARS-COV-2 forecasting can be daunting, considering the pandemic's intricate nature and the various factors influencing its transmission. Researchers need to contemplate several aspects, such as model intricacy, interpretability, and generalizability when creating and evaluating forecasting models. Furthermore, the rapidly changing dynamics of the pandemic demand continuous model adaptation and assessment, as models that excel at one point may become less precise as the situation progresses. Despite these challenges, advanced deep-learning models have demonstrated the potential in capturing complex data patterns and providing accurate forecasts. By comprehending the challenges and complexities of SARS-COV-2 forecasting, researchers can persist in developing and refining models, ultimately contributing to informed policymaking, strategic resource allocation, and efficient public health interventions in Malaysia. Brief Comparative Studies in Malaysia Numerous studies have carried out comparative analyses of deep learning models to assess their performance in predicting pandemic cases in Malaysia. [7][8][9] performed an extensive comparison of GRU, LSTM, and CNN models for forecasting cases in Malaysia. The authors utilized daily recoveries, confirmed cases, and deaths as input features for models and assessed their performance using metrics such as MAE and RMSE. The study aimed to identify the best deep learning model to capture complex temporal patterns in the data and provide accurate forecasts. The results revealed that both LSTM and GRU surpassed the CNN model in terms of prediction accuracy. [10][11][12][13][14][15]; used LSTM, GRU, and Transformer models for predicting SARS-COV-2 cases in Malaysia. They employed similar features as previous researchers, focusing on daily cases, deaths, and confirmed cases. Evaluation metrics such as MAE, RMSE, and MAPE were used. The study aimed to determine the best deep learning model for identifying the complex nature of the relationship between different features. The authors credited this finding to the Transformer model's self-attention mechanism, which allowed it to capture complex dependencies in the data more effectively than the LSTM and GRU models. Furthermore, the Transformer model demonstrated faster training times and better scalability compared to the other models, making it a more practical choice for large-scale SARS-COV-2 forecasting tasks in Malaysia.
[ [16][17][18][19][20][21] used LSTM, GRU, and CNN-based models for predicting cases in Malaysia and various other countries. The authors employed daily confirmed cases as input features and evaluated the models' performance using MAE and RMSE. Their study concluded that LSTM and GRU models outperformed CNN models, emphasizing the importance of selecting appropriate deep-learning models for pandemic evolution prediction in Malaysia. Researchers [22][23][24][25] compared LSTM, GRU, and 1D-CNN models in the context of forecasting future cases in Malaysia. They utilized similar features and evaluation metrics as earlier studies. The results revealed that GRU models exhibited the best overall performance, showcasing their potential for predicting cases in Malaysia. [26][27][28][29][30] provided a comparison of LSTM, GRU, and CNN models, employing features and evaluation metrics like MAE and RMSE, consistent with previous research. The importance of selecting suitable deep-learning models for case prediction was emphasized. In a comparison of LSTM, GRU, and Prophet models for forecasting cases in Malaysia [31][32][33][34][35], MAE and RMSE were used as evaluation metrics. The study found that LSTM and GRU models outperformed the Prophet model. [36][37][38][39][40] used LSTM, GRU, and 1D-CNN models, using daily confirmed cases, recoveries, and deaths as input features, and MAE, RMSE, and MAPE for evaluating model performance. The GRU model performed the best in this context. [41][42][43] conducted a comparative study on LSTM, GRU, and CNN models for Malaysia, using similar features and metrics as previous research (MAE and RMSE). The GRU model was found to achieve the highest prediction accuracy. [44][45][46][47] used LSTM, GRU, and CNN models, using MAE, RMSE, and MAPE alongside similar features as earlier studies. The LSTM model provided the best performance. [48][49][50][51][52] carried out a comparative study involving LSTM, GRU, and 1D-CNN models for Malaysia, using similar features and evaluation metrics as previous researchers. The LSTM model achieved the highest prediction accuracy in this context. [53] used the VMD-Staked GRU model to accurately predict individual stock finances from the industry environment factors that provide significantly improved predictions. [54] compared LSTM and other popular models for energy consumption forecasting that provided to have high accuracy for energy systems. [55] provided a comprehensive analysis using machine learning approaches that highlighted the rapid growth, geo trends, and their applications in various domains.
These comparative studies emphasize the significance of choosing the most appropriate deep-learning model for understanding the pandemic's progression in Malaysia. While LSTM and GRU models have proven successful in capturing long-range dependencies in time series data, CNN models have also demonstrated effectiveness in certain scenarios. The selection of a deep-learning model should be based on the specific needs and limitations of the forecasting task, as well as the available data and computational resources. Moreover, these studies underscore the importance of employing deep learning models to generate accurate and dependable forecasts, which can aid decision-makers and public health officials in mitigating the pandemic's impact in Malaysia.

Material and methods
We have focused on first performing different steps on the collected data and then performing tests using each deep learning model. Further, we have improved the models with Bayesian optimization to find out the difference between the optimization and without optimization of models. The study comprises data collection and preprocessing, model selection, model training and evaluation, and performance comparison.

Data collection
The study utilized daily SARS-COV-2 data from Malaysia, including confirmed cases, recoveries, and deaths. Data were gathered from official sources like the World Health Organization (WHO) and the Malaysia Ministry of Health. Additional data, such as government interventions, mobility patterns, and vaccination rates, were also collected to offer contextual information and enhance the models' forecasting accuracy. The data chosen for this study was up until December 2022.

Descriptive statistics
Following are the descriptive statistics of data presented in Table 1 as commutative observations. There were 1094 total observations with an average of daily new cases of around 4,595 with a standard deviation of 6,572 showing a wide variation of the daily new cases. The highest number of cases was 33,406. The average total vaccinations were approximately 49.30 million with the number of fully vaccinated people around 19.54 million. The reduction rate of the virus has been an average value of 1.04 with varying ranges of 0.51 and 2.54.

Data preprocessing, exploratory data analysis, and feature selection
The gathered data underwent preprocessing to ensure compatibility with the deep learning models. The preprocessing steps included: Data cleaning: Eliminating any missing or inconsistent values and addressing potential outliers.
Feature engineering: Generating additional features, such as moving averages and growth rates, to capture relevant patterns in the data.
Data normalization: Scaling the features to a standard range (e.g., 0-1) to facilitate model training and convergence.
Sequence generation: Converting the time series data into input-output sequences with a specified window length for model training.
Exploratory data analysis was conducted to detect any anomalies and produce graphical visualizations.

Model selection, parameters, and optimization
Several Python libraries were employed, including Numpy, Matplotlib, SkLearn, Keras, Scipy, and TensorFlow. Seven advanced deep-learning models were chosen for the comparative study:  These models were selected based on their proven performance in previous SARS-COV-2 forecasting studies and their capacity to capture intricate patterns and dependencies in time series data. Further Bayesian optimization was used to select the best possible hyperparameter for the dataset for each of the algorithms and then models were evaluated again to find the best accuracy. The following are initial parameters used for each algorithm presented below in Table 2.
It is worth noting that each algorithm works differently with a change of parameters as per the data requirement. We have further used a batch size of 1 and trained over 100 epochs for each model. These parameters were further hyper-tuned using Bayesian optimization.

Results and discussion
We have presented first the performance of each deep learning model (LSTM, Bi-LSTM, CNN, CNN-LSTM, GRU, RNN, and MLP) without optimization and then with optimization of the models. The results are summarized using tables and graphs to illustrate the performance of the models based on various evaluation metrics (e.g., MAE, MAPE, MSE, RMSE, and R-Squared) and to visually compare their predictions with the actual data. The selected evaluation metrics were the best ones suited for time series data. However, many previous researchers have only used two metrics. However, as per previous studies, researchers just focused on one to three metrics only. Whereas the current evaluation focused on in-depth evaluation through five different evaluation metrics which were best suited for time series data. Table 3 provides a summary of the evaluation metrics for each model without optimization. R-squared: MLP model has the highest R-squared value (0.9982), indicating the best performance in terms of explaining the variability in the data. The GRU model follows with an Rsquared value of (0.9961), while the RNN model has an R-squared value of (0 9897). The CNN-LSTM and CNN models have lower R-squared values of (0.8471), indicating that they are less effective in explaining the variability in the data compared to the other models.

Models performance metrics
Best Performing Model without Optimization: Based on the above evaluation metrics and results, the GRU model consistently outperformed all other models in most of the metrics, with the lowest MAE, MSE, and RMSE values, and a high R-squared value. This indicates that the GRU model is effective in capturing the temporal dependencies in the data and providing accurate predictions for SARS-COV-2 cases in Malaysia. The RNN and LSTM models also show good performance in some metrics, but the GRU model appears to be the most effective overall.
The MLP model has the highest R-squared value, suggesting it is the best at explaining the variability in the data. However, its high MAE, MSE, and RMSE values indicate a poorer performance compared with other models. Therefore, the GRU model was the best-performing model based on the evaluation metric results for predicting SARS-COV-2 cases in this context. Table 4 provides a summary of the evaluation metrics for each model with optimization. For this study, we have used Bayesian optimizer for hyperparameter selection and further evaluating the model performance. We have performed minimum 10 trails to find out the best performance values for each model. The value used for optimization were 'adam', 'sgd', 'rmsprop', 'nadam', 'ftrl', 'adagrad', and 'adadelta'.    The improved performance of different models shows that optimization techniques can significantly improve performance. With adjustment of different model parameters using the learning rate, training epochs, batch sizes, and optimizer types, significantly affects the model learning from data. We will delve deeper into the analysis by comparing each evaluation metric for better understanding. MSE: GRU with optimization has the lowest MSE at 1.4403, suggesting the best prediction accuracy in terms of squared differences.

RMSE:
Lower RMSE values indicate better prediction accuracy. The GRU with optimization has the lowest RMSE at 0.00037, indicating the best prediction accuracy in terms of rootsquared differences.
R-squared: The RNN with optimization has the highest R-squared value at 0.9996, indicating the best prediction accuracy in terms of the proportion of variance explained by the model.

Summary of Best Performing Model with Optimization:
Based on the evaluation metrics, the RNN with optimization appears to be the best-performing model, as it has the lowest MAE and the highest R-squared value. The GRU with optimization also demonstrates strong performance with the lowest MSE and RMSE values.   GRU: The optimized GRU model shows improvements in all evaluation metrics, with notable improvements in MAE (from 0.00123 to 0.000314) and R-squared (from 0.9961 to 0.99967).

Comparison between original and optimized models
MLP: The optimized MLP model demonstrates significant improvements in all evaluation metrics, particularly in MAE (from 3058.42 to 0.00049) and R-squared (from 0.998 to 0.9990).
In conclusion, the optimization process led to substantial improvements in the evaluation metrics for all models. The RNN and GRU models, in particular, have shown the best performance after optimization. This highlights the importance of optimizing deep learning models to achieve better prediction accuracy in forecasting tasks.

Conclusion and recommendation for future research
Future research could explore alternative feature selection and preprocessing techniques to improve model performance in the Malaysian context. The study focused on filling the research gaps by forecasting SARS-COV-2 using various deep-learning methods. The models helped to accurately forecast the changing landscape of infections in Malaysia. Additionally, our study contributes to the growing body of research on using deep learning models for pandemic forecasting, which could be applied to future public health crises. Among all tested models and based on evaluation metrics, the RNN with optimization appears to be the bestperforming model, as it has the lowest MAE and the highest R-squared value. The GRU with optimization also demonstrates strong performance with the lowest MSE and RMSE values.
Additionally, studies could investigate the cause of the perfect scores observed for the RNN and MLP models and develop strategies to address these issues. Researchers could also consider applying other optimization methods other than Bayesian Optimization. By using the best-performing models to predict new cases, they can make more informed decisions about resource allocation, public health measures, and vaccination strategies.
Accurate forecasting of SARS-COV-2 dynamics is crucial for informed policy-making and resource allocation in Malaysia. Different model's superior performance can provide valuable insights for public health officials and decision-makers in the country. By leveraging these models, authorities can better anticipate the pandemic's trajectory, implement timely interventions, and allocate resources efficiently to mitigate the impact of the virus on the population. The discussion section highlights the performance of the deep learning models, compares the findings with previous studies, acknowledges limitations, and suggests future research